this.require.define({
  "eevee/react_page/helper": function (exports, require, module) {
    var React = window.React || require('react');
    var ReactDom = window.ReactDOM || require('react-dom');
    if (typeof Object.assign != 'function') {
      Object.assign = function (target) {
        //第一个传参不能是undefined和null，因为它们不能被转为对象
        if (target === undefined || target === null) {
          throw new TypeError('Can not convert undefined or null to object');
        }
        //使用Object对象化target
        var output = Object(target);
        for (var idx = 1, l = arguments.length; index < l; idx++) {
          var source = arguments[idx];
          //后续传参也需要判断undefined和null
          if (source !== undefined && source !== null) {
            for (var key in source) {
              if (Object.prototype.hasOwnProperty.call(source, key)) {
                output[key] = source[key];
              }
            }
          }
        }
        return output;
      };
    }
    var designerContextCache = {};

    function setToCache(id, state) {
      if (!state || !id || !_react_render_url_) return;
      var cache = designerContextCache[_react_render_url_];
      if (!cache) {
        designerContextCache[_react_render_url_] = cache = {};
      }
      cache[id] = state;
    }

    function getFromCache(id) {
      if (id && _react_render_url_) {
        var cache = designerContextCache[_react_render_url_];
        if (cache) {
          return cache[id] || {};
        }
      }
      return {};
    }

    var connect = function (wrappedComponent) {
      return React.createClass({
        contextTypes: {
          context: React.PropTypes.object
        },
        componentWillUnmount: function () {
          setToCache(this.props._UUID_, this.COMP.state);
        },
        render: function () {
          var _this = this;
          var props = Object.assign({}, this.props,
            {
              _initState: getFromCache(this.props._UUID_),
              ref: function (_ref) { _this.COMP = _ref; },
              context: this.context.context
            });
          return React.createElement(wrappedComponent, props);
        }
      });
    };
    var initDesignPart = function (parts, context) {
      for (var i = 0, len = parts.length; i < len; i++) {
        if (parts[i].attributes['data-react-render-id']) {
          var renderId = parts[i].attributes['data-react-render-id'].value;
          var Component = window['_react_render_'][renderId]();
          Component.prototype.getChildContext = function () {
            return {
              context: Object.assign({}, context)
            };
          };
          Component.childContextTypes = {
            context: React.PropTypes.object
          };
          ReactDom.render(React.createElement(Component), parts[i]);
        }
      }
    };
    module.exports = {
      connect: connect,
      initDesignPart: initDesignPart
    };
  }
});